﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for KPage
/// </summary>
public class KPage : System.Web.UI.Page
{
	public KPage()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    private KUser user;

    public KUser User
    {
        get { return user; }
        set { user = value; }
    }
    
    protected override void OnLoad(EventArgs e)
    {
        this.ErrorPage = UTIL.PageError;
        Session["CallerPage"] = Request.CurrentExecutionFilePath;
        if (Session["User"] == null)
        {
            Response.Redirect(UTIL.PageLogin);
        }
        else
        {
            User = (KUser)Session["User"];
            if (!user.AllowedToSeePage(Request.CurrentExecutionFilePath.ToLower()))
            {
                Response.Redirect(UTIL.PageNotAllowed);
            }
        }
        base.OnLoad(e); //Page_Load çağırmak için
    }
}